import { BrowserRouter as Router, Route, Redirect, Switch } from "react-router-dom"
// 懒加载
import React from "react"
const Layout = React.lazy(() => import('@/pages/Layout'))
const Login = React.lazy(() => import('@/pages/Login'))
const NotFound = React.lazy(() => import('@/pages/NotFound'))
export default function App() {
    return (
        <Router>
            <React.Suspense fallback={<div>loading...</div>}>
                <Switch>
                    <Redirect exact from="/" to="/layout" />
                    <Route path="/login" component={Login} />
                    <Route path="/layout" component={Layout} />
                    <Route path="*" component={NotFound} />
                </Switch>
            </React.Suspense>
        </Router>
    )
}
